/*
使vue-router懒加载时可以显示一个加载提示，避免网速慢时无响应
用法:
const index = resolve => {
    spinRoute.show();
    require(['./setting.vue'], spinRoute.resolve(resolve))
};
*/
import { Loading } from 'element-ui'

var unique
export default viewPath => {
    return resolve => {
        if (!unique) unique = Loading.service({ customClass: 'global-mask' })
        require(['@/views/' + viewPath + '.vue'], component => {
            if (unique) unique.close()
            resolve(component)
        })
    }
}
